var LevelAnimation = cc.Class({
    extends: cc.Component,

    properties: ()=>({
        main: {
            default: null,
            type: require("Main")
        },
        anim: {
            default: null,
            type: cc.Animation
        }
    }),
    play: function() {
        var animState = this.anim.play('levels');
        animState.wrapMode = cc.WrapMode.Normal;
        this.anim.on('finished', this.onFinished, this);
    },
    reversePlay: function() {
        var animState = this.anim.play('levels');
        animState.wrapMode = cc.WrapMode.Reverse;
        this.anim.on('finished', this.onFinished2, this);
    },
    onFinished: function() {
        this.anim.off('finished', this.onFinished, this);
    },
    onFinished2: function() {
        this.main.paneStart.x = 260;
        this.anim.off('finished', this.onFinished2, this);
    },

});
module.exports = LevelAnimation;
